package com.example.demo99.Service.Impl;

import com.example.demo99.Entity.Student;
import com.example.demo99.Mapper.StudentMapper;
import com.example.demo99.Service.StudentService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

  @Autowired
    private StudentMapper studentMapper;


    public int addStudent(Student student) {
        return studentMapper.insertStudent(student);
    }


    public int removeStudent(int id) {
        return studentMapper.deleteStudentById(id);
    }


    public List<Student> getAllStudents() {
        return studentMapper.getAllStudents();
    }


    public Student getStudent(int id) {
        return studentMapper.getStudentById(id);
    }
}
